package com.lx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lx.entity.LxUser;
import com.lx.mapper.LxUserMapper;
import com.lx.service.LxUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>9/
 *
 * @author 赵敬轩
 * @since 2021-09-12
 */
@Service
public class LxUserServiceImpl extends ServiceImpl<LxUserMapper, LxUser> implements LxUserService{
    @Autowired
    private LxUserMapper lxUserMapper;
    public IPage<LxUser> selectAllUser(Integer page, Integer limit) {
        Page<LxUser> pager = new Page<>(page,limit);
        IPage<LxUser> lxUserIPage = lxUserMapper.selectPage(pager, null);
        return lxUserIPage;
    }
    public List<LxUser> selectByName(String uname) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.like("u_name",uname);
        //踩坑List对应selectList  不要对应踩坑List对应selectMap
        List<LxUser> list = lxUserMapper.selectList(wrapper);
        System.out.println("Service的"+ list);
        return list;
    }
}
